package com.shan.design.combination.practice;

import java.util.ArrayList;
import java.util.List;

/**
 * 容器构建：窗体类
 * @author shanzheng
 * @date 2018-12-02 19:27
 **/
public class WindowView extends AbstractView{
    private List<AbstractView> abstractViews = new ArrayList<>();
    private String name;

    public WindowView(String name) {
        this.name = name;
    }

    public void add(AbstractView abstractView) {
        abstractViews.add(abstractView);
    }

    public void remove(AbstractView abstractView) {
        abstractViews.remove(abstractView);
    }
    public AbstractView get(int index) {
        return abstractViews.get(index);
    }

    @Override
    void buildView() {
        // 构建页面
        System.out.println("****'" + name + "'进行展示");
        for (AbstractView view : abstractViews) {
            view.buildView();
        }
    }
}
